home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Backup, Restoration & File Management
/
SyncBack SE 5.1
/
SyncBackSE_Setup.exe
/
{app}
/
ReSpace.vbs
< prev
next >
Wrap
Text File
|
2007-11-21
|
1KB
|
57 lines
' ReSpace.VBS written by Dave Wilkins 2007
' complementary script to DeSpace.VBS
' (see comments in DeSpace.vbs for further details)
' Note that any pre-existing underscores in filenames will be turned
' into spaces by ReSpace.VBS, if used, ie
' original: My File_Name.ext
' DeSpaced: My_File_Name.ext
' ReSpaced: My File Name.ext
RootFolder = "X:\ROOT_FOLDER"
'OR
' Set objArgs = WScript.Arguments
' RootFolder = objArgs.Item(0)
' note that any path argument with spaces must be wrapped in " "
RootFolder = RTB(RootFolder) ' remove trailing backslash (if any)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folders = FSO.GetFolder(RootFolder)
Recurse Folders
' < = < =< = < = end of main logioc / start of subs & functions = > = > = > = >
Sub Recurse (ByRef Folders)
Set SubFolders = Folders.SubFolders
Set Files = Folders.Files
For Each File In Files
Temp = Replace(File.Name, "_", " ")
If File.Name <> Temp Then File.Name = Temp
Next
For Each SubFolder In SubFolders
Temp = Replace(SubFolder.Name, "_", " ")
If SubFolder.Name <> Temp Then SubFolder.Name = Temp
Recurse SubFolder
Next
End Sub
Function RTB(sPath) ' Remove Trailing Backslash from Path in question
Len_sPath = Len(sPath)
If Right(sPath, 1) = "\" Then
sPath = Left(sPath, Len_sPath-1)
End If
RTB = sPath
End Function